//
//  KSDropDownFilterV.swift
//  ANOA
//
//  Created by 邱仙凯 on 2024/12/16.
//  Copyright © 2024 zwb. All rights reserved.
//

import UIKit

class KSDropDownFilterV: KSBaseFilterV {
    
   
 
    override func layoutContentV() {
        
        tableAndConfirmV.frame = CGRect(x:0,y:-self.appearance.bgHeight,width: KSGlobal.screenW,height: self.appearance.bgHeight)
        tableAndConfirmV.setMutiBorderRoundingCorners(corner: [.bottomLeft,.bottomRight], number: 12)
        self.tableView?.reloadData()
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        UIView.animate(withDuration: 0.2) { //  出现时
            
            self.tableAndConfirmV.ks_y = 0
        }
    }
    
    // 添加到父控件上
//    override func willMove(toSuperview newSuperview: UIView?) {
//        
//        if newSuperview.isSome {
//        
//            UIView.animate(withDuration: 0.2) { //  出现时
//                
//                self.tableAndConfirmV.ks_y = 0
//            }
//        }
//        
//    }
    
    @objc override func close(){
        UIView.animate(withDuration: 0.2) {
            self.tableAndConfirmV.ks_y = -self.appearance.bgHeight
      
        }
        
        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.2) {
            self.dismiss(animated: false)
        }
        
        if let clo = self.closeClosure {
            clo()
        }
    }
    
 
}
